package org.cskt.sl.ebank.service.impl;

import java.util.List;

import org.cskt.sl.ebank.dao.ConsumeAccountMapper;
import org.cskt.sl.ebank.entity.CommonExample;
import org.cskt.sl.ebank.entity.ConsumeAccount;
import org.cskt.sl.ebank.service.ConsumeAccountService;
import org.cskt.sl.util.Pager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 积分消费记录 service
 * @author guddqs
 *
 */
@Service
public class ConsumeAccountServiceImpl implements ConsumeAccountService{

	@Autowired
	private ConsumeAccountMapper mapper;

	@Override
	public int countByExample(CommonExample example) {
		return mapper.countByExample(example);
	}

	@Override
	public int addConsumeAccount(ConsumeAccount record) {
		return mapper.insertSelective(record);
	}

	@Override
	public List<ConsumeAccount> findConsumeAccountPageList(CommonExample example, Pager pager) {
		if(pager!=null){
			if(pager.getCurrentPage()!=null){
				int first=(pager.getCurrentPage()-1)*pager.getPageSize();
				int max=pager.getPageSize();
				return mapper.selectByExample(example, first, max);
			}
		}
		return null;
	}
	

}
